package com.design.patterns.list.command.light;

import com.design.patterns.list.command.Command;

/**
 * @author Wangzhiwen
 */
public class LightOffCommand implements Command {

    private LightReceiver lightReceiver;

    public LightOffCommand(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    public void setLightReceiver(LightReceiver lightReceiver) {
        this.lightReceiver = lightReceiver;
    }

    @Override
    public Object commandIdentification() {
        return lightReceiver.lightReceiverIdentification() + " Off Command";
    }

    @Override
    public void execute() {
        lightReceiver.off();
    }

    @Override
    public void undo() {
        lightReceiver.on();
    }
}
